﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SheepStorage.API.Application.Command.SheepMomPergnantCommand;
using SheepStorage.API.Baseclass;
using SheepStorage.Domain.DTO.Output;
using SheepStorage.Domain.Entity;
using SheepStorage.Domain.Enum;
using SheepStorage.Service.DataImp;
using SheepStorage.Service.Interface;

namespace SheepStorage.API.Controllers
{
    /// <summary>
    /// 种母妊娠
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class SheepMomPergnantController : ControllerBase
    {
        private readonly IMediator _mediator;
        private readonly ISheepMomPergnantService sheepMomPergnant;

        public SheepMomPergnantController(IMediator mediator, ISheepMomPergnantService sheepMomPergnant)
        {
            _mediator = mediator;
            this.sheepMomPergnant = sheepMomPergnant;
        }
        /// <summary>
        /// 种母妊娠列表
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<List<SheepMomPergnantDto>>> GetSheepMomPergnant(SheepMomPergnantShowCommand ?request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 种母妊娠添加
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> AddSheepMomPergnant(SheepMomPergnantAddCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 种母妊娠信息删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> DelSheepMomPergnant(SheepMomPergnantDelCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 种母妊娠反填信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<SheepMomPergnant>> BackfillSheepMomPergnant(SheepMomPergnantBackfillCommand request)
        {
            return await _mediator.Send(request);
        }
        /// <summary>
        /// 种母妊娠修改信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Results<int>> UpdateSheepMomPergnant(SheepMomPergnantUpdateCommand request)
        {
            return await _mediator.Send(request);
        }
    }
}
